package cn.pzhu.controller.admin;

import cn.pzhu.controller.BaseController;
import cn.pzhu.services.admin.AchievementServices;
import cn.pzhu.services.admin.DemandServices;

import java.util.List;

/**
 * Created by dongp on 2016/4/27.
 */
public class DemandController extends BaseController {

    private DemandServices demandServices = new DemandServices();

    public void index() {
        render("demand.jsp");
    }

    public void ajaxQuery() {
        String pageNumber = getPara("pageNumber");
        String pageSize = getPara("pageSize");
        String search = getPara("search","");
        List attrs = demandServices.ajaxQuery(pageNumber,pageSize,search);
        renderJson(attrs);
    }

    public void ajaxUpdate() {
        int id = getParaToInt("id");
        int status = getParaToInt("status");

        boolean result = demandServices.ajaxUpdate(id,status);
        if(result) {
            setAttr("msg","success");// 该返回的成功信息前台暂时没用
        }else {
            setAttr("msg","failue");
        }

        render("demand.jsp");
    }

}
